package com.simple.common.entity.req.info;

import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.simple.common.entity.req.vm.pay.ReqBase;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.function.Consumer;

import static com.simple.common.entity.constant.Payment.*;


/**
 * @author yasud
 * @date 2021年03月02日 14:39
 * @description
 */
@Data
public class InfoReq extends InfoReqBase {

    /**
     * 产品code
     */
    @NotBlank(message = "product code is empty")
    private String productCode;

    @Override
    public void check(Consumer<ReqBase>... consumers) {
        Preconditions.checkState(Lists.newArrayList(
                VM_DIRECT_PAY_CODE,
                VM_DIRECT_PAY_2_CODE,
                VM_REDIRECT_PAY_CODE,
                VM_REDIRECT_PAY_2_CODE,
                INDIA_PAY_CODE,
                INDIA_WITHDRAWAL_CODE,
                VIETNAM_PAY_CODE,
                VIETNAM_WITHDRAWAL_CODE,
                AFRICA_PAY_CODE,
                AFRICA_WITHDRAWAL_CODE).contains(productCode), "product code  invalidate");
        super.check(consumers);
    }
}
